/* R. J. Cano, since Tue Nov 29 2016, 19:56 GMT */

/* @draft discussion A278328

On those numbers F(n,b), being F hypotetically another sequence focused in base b (here b=10), such that F(n) and rev(F(n)) are different which implies that F(n) is NOT a palindrome when expressed in base b) and F(n) is the least integer such that abs(F(n)-rev(F(n))) is a (n+1)th power;

 Visit: https://oeis.org/draft/A278328

*/

is(x,n,{b=10})={
  my(a=digits(x,b));
  my(c=vector(#a,i,a[#a+1-i]));
  if(a!=c,
    return(ispower(abs(x-subst(Pol(c,y),y,b)),n))
    ,
    return(0)
  )
}

printSeq(z,{z0=0},{N0=1},{b=10})={
  my(N=N0+1,t=z0,Lst:list);
  Lst=List();
  while(t++<=z,
    if(is(t,N,b),print1(" ",t);N++;listput(Lst,t))
  );
  return(vector(#Lst,i,Lst[i])); \\ imho Better it is, a vector instead of a list;
}

/* If you're RESUMING a previous search, z0 is the last found value, and N0 should be the index for the next term to be found.
   if you only wish to search for another base (let us say for example Heptal) then you can start with something like:

   printSeq(10^12,,,7);

  */

